// ScreenRecord.cpp : implementation file
//

#include "stdafx.h"
#include "..\PubQQ.h"
#include "..\define\DefineComm.h"
#include "..\define\DefineUser.h"
//#include "..\define\DefineUser.h"
//#include "..\define\DefineChat.h"
#include "ScreenRecord.h"
#include "..\ximage\ximage.h"
#include "..\Media\VideoLocal.h"
//#include "CommClient.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CScreenRecord dialog

	extern	int BMPsize;
	extern	int JPGsize;
	CScreenRecord*	m_pScreenRecord;
	CScreenRecordBase*	m_pScreenRecordBase;
CScreenRecord::CScreenRecord(CWnd* pParent /*=NULL*/)
	: CScreenRecordBase(CScreenRecord::IDD, pParent)
{
	//{{AFX_DATA_INIT(CScreenRecord)
	//}}AFX_DATA_INITm_IsFinish
    m_pScreenRecord = NULL;
    m_pScreenRecordBase = NULL;
}

CScreenRecord::~CScreenRecord()
{
}

void CScreenRecord::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CScreenRecord)
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CScreenRecord, CDialog)
	//{{AFX_MSG_MAP(CScreenRecord)
	ON_WM_TIMER()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CScreenRecord message handlers

void CScreenRecord::OnTimer(UINT nIDEvent) 
{
	if(m_IsFinish)
        OnScreenCatch();	
	CDialog::OnTimer(nIDEvent);
}

void CScreenRecord::Start()
{
	if(m_IsRecord == FALSE)
	{
		SetTimer(51,100,NULL);
	}
	m_IsRecord = TRUE;
    m_IsFinish = TRUE;
}

void CScreenRecord::Stop()
{
	if(m_IsRecord == TRUE)
	{
		KillTimer(51);
	}
	m_IsRecord = FALSE;
}

void CScreenRecord::Init()
{
   /* m_pScreenRecord = new CScreenRecordBase;
	    if (! IsWindow(m_pScreenRecord->GetSafeHwnd()))
		{
		   m_pScreenRecord->Create(IDD_SCREEN_RECORD);
		   m_pScreenRecord->ShowWindow(SW_HIDE);
		}*/
//InitDialog();
}

void CScreenRecord::InitDialog()
{
    m_pScreenRecord = new CScreenRecord;
	    if (! IsWindow(m_pScreenRecord->GetSafeHwnd()))
		{
		   m_pScreenRecord->Create(IDD_SCREEN_RECORD);
		   m_pScreenRecord->ShowWindow(SW_HIDE);
		}
//m_pScreenRecord = (CScreenRecordBase*)dlg;
m_pScreenRecordBase = (CScreenRecordBase*)m_pScreenRecord;
//m_pScreenRecord = dlg;
//CScreenRecordBase* pScreenRecord = (CScreenRecordBase*)dlg;
}

